<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../../css/general.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/mui.promptpwd.css"/>
		
		<link rel="stylesheet" type="text/css" href="../../css/lcs-pop.css"/>
		<style type="text/css">
			*{
				font-size: 0.95em;
			}
			.main{
				width: 100%;
				margin: 0.5em 0;
			}
			.dherder{
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				background-color: white;
				padding: 0.5em;
			}
			.dleft{
				width: 20%;
				display: flex;
				justify-content: flex-start;
				align-items: center;
			}
			.dleft>img{
				width: 100%;
				border-radius: 50%;
			}
			.dcentent{
				width: 100%;
				margin: 0.5em 0;
				background-color: white;
				padding: 0.5em;
			}
			.dcentent>div{
				padding: 0.5em 0;
				
			}
			.dpay{
				width: 100%;
				margin: 0.5em 0;
				background-color: white;
				padding: 0.5em;
			}
			.dbz{
				width: 100%;
				margin: 0.5em 0;
				background-color: white;
				padding: 0.5em;
			}
			.dsex{
				width: 100%;
				margin: 0.5em 0;
				background-color: white;
				padding: 0.5em;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
			.dsex>div{
				width: 50%;
			}
			.footdiv>div{
				width: 50%;
				height: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
			}
			
			.ssdiv>input {
			    width: 60%;
			    height: 2em;
			    border: 0;
			    /*border-bottom: 1px solid #c7c7c7;*/
			    padding-left: 0.5em;
			}
			.ssdivleft {
			    width: 20%;
			    height: 2em;
			    text-align: center;
			    line-height: 2em;
			    border: 0;
			    border-right: 1px solid #c7c7c7;
			}
			
				
.checklist{
				background-color: white !important;
				border-radius: 0.5em;
				margin: 0px auto;
				padding: 11px;
			}
			.flex1{
				width: 100%;
				display: flex;
				justify-content: center;
				align-items: center;
				position: relative;
			}
			.left{
				width: 20%;
			}
			.left>img{
				width: 100%;
				border-radius:50% ;
			}
			.right{
				padding-left:1em ;
				width: 80%;
				display: flex;
				justify-content: center;
				align-items: flex-start;
				flex-direction: column;
				color: #676664;
				
			}
			.right>div{
				padding: 0.2em;
				
			}
			.flexrowbetween{
				display: flex;
				width: 60%;
				justify-content: space-between;
				align-items: center;
			}
			.yhinput{
				border: 0;
			}
			.flex-row-start{
				display: flex;
				align-items: center;
				justify-content: flex-start;
			}
			
			input[type=number]{
    line-height: 21px;
    width: 100%;
    height: 30px;
    margin-bottom: 0px;
    padding: 10px 15px;
    -webkit-user-select: text;
    border: 0;
    outline: 0;
    background-color: #fff;
    -webkit-appearance: none;
}
input[type=text]{
	margin-bottom: 0px;
	border:0;
}

.publicdiv>.mui-table-view-cell {
    position: relative;
    overflow: hidden;
    padding: 3px 0px;
    -webkit-touch-callout: none;
}
.list-right{
	position: absolute;
    top: 50%;
    right: 15px;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    display: block;
    background-color: white;
}
.list-money{
	color: darkorange;
	font-size: 1.2em;
}
.list-badge {
	position: absolute;
    top: 50%;
    right: 45px;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    font-size: 12px;
    line-height: 1;
    display: inline-block;
    padding: 3px 6px;
    color: #333;
    border-radius: 100px;
}
.list-navigate-right:after{
    font-family: Muiicons;
    font-size: inherit;
    line-height: 1;
    position: absolute;
    top: 50%;
    display: inline-block;
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    text-decoration: none;
    color: #bbb;
    -webkit-font-smoothing: antialiased;
}

.list-navigate-right:after {
    right: 25px;
    content: '';
}

.listdiv{
	padding: 11px;
	text-align: center;
	position: relative;
}
.imgdiv>img{
	max-width: 70%;
	max-height: calc(100% - 30px - 18px - 10px - 12px);
}
.zfdiv{
	color: red;
}
.zfdiv>span{
	color: red;
}
.footbut{
	position: absolute;
	width: calc(100% - 22px) ;
	bottom: 10px;
}
.footgd{
	height: calc(30px + 18px);
}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav hbg">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left colorw"></a>
		    <h1 class="mui-title">结账</h1>
		</header>
		<div class="mui-content">
		    <div class="main">
		    	<div class="checklist" id="memberdiv">
		    		<div class="flex1">
		    			<div class="dleft">
							<img class="border50" src="../../img/member-header.png"/>
		    	    	</div>
		    	    	<div class="right">
		    	    		<div class="flexrowbetween"><span id=""></span>
		    	    	</div>
		    	    	</div>
		    		</div>
		    	</div>
		    	
		    	<div class="dcentent">
		    		<ul class="mui-table-view publicdiv">
		    		        <li class="mui-table-view-cell">
		    		            <div class="mui-input-row">
		    		                <label>应付金额：</label>
		    		                <input type="number" id="yfvalue" readonly="readonly" placeholder="请输入应付金额">
		    		            </div>
		    		        </li>
		    		        <li class="mui-table-view-cell">
		    		             <div class="mui-input-row">
		    		                <label>优惠金额：</label>
		    		                <input type="number" id="yhinput" placeholder="请输入优惠金额">
		    		            </div>
		    		        </li>
		    		    </ul>
		    		    <ul class="mui-table-view">
		    		    	<li class="mui-table-view-cell hidden" id="ypop">
		    		                <a class="mui-navigate-right">
		    		                     优惠券：<span id="yhq" class="mui-badge mui-badge-danger">0张</span>
		    		                </a>
		    		        </li>
		    		            <li class="mui-table-view-cell mui-checkbox hidden" id="czzfli">
		    		                <a class="list-navigate-right">
		    		                     余额支付：<span id="cxzf" class="list-badge ">是否余额支付</span>
		    		                </a>
		    		                <input id="checkcxzf" name="checkbox" type="checkbox">
		    		            </li>
		    		            <li class="mui-table-view-cell">
		    		                <a class="list-navigate-right">
		    		                     还需支付：<span id="sfvalue" class="list-right list-money"></span>
		    		                </a>
		    		            </li>
		    		           
		    		    </ul>
		    		    <!--
                        	作者：592176224@qq.com
                        	时间：2019-03-07
                        	描述：
		    		<div class="flex-row-start border-b">
		    			<span id="">
		    				应付金额：
		    			</span>
		    			<span >
		    				<input class="yhinput" id="yfvalue" type="number" name=""  value="" placeholder="请输入优惠金额"/>
		    			</span>
		    			
		    		</div>
		    		<div class="flex-row-start border-b">
		    			<span id="">
		    				优惠金额：
		    			</span>
		    			<span id="">
		    				<input class="yhinput" id="yhinput" type="number" name="" value="" placeholder="请输入优惠金额"/>
		    			</span>
		    		</div>
		    		<div class="">
		    			<span id="">
		    				还需支付：
		    			</span>
		    			<span id="sfvalue">
		    				
		    			</span>
		    		</div>
                        -->
		    	</div>
		    	<div class="dpay" id="dpaydiv">
		    		<div class="mui-slider">
		    		    <div class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
		    		        <a class="mui-control-item" id="1" href="#item1">普通支付</a>
		    		        <a class="mui-control-item" id="3" href="#item2">移动支付</a>
		    		    </div>
		    		    <div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-6"></div>
		    		    <div class="mui-slider-group">
		    		        <div id="item1" class="mui-slider-item mui-control-content">
		    		            <ul class="mui-table-view mui-table-view-radio">
					    		    <li class="mui-table-view-cell mui-selected">
					    		        <a id="2" class="mui-navigate-right">现金支付</a>
					    		    </li>
					    		    <li class="mui-table-view-cell">
					    		        <a id="6" class="mui-navigate-right">银行卡记账</a>
					    		    </li>
					    		    <li class="mui-table-view-cell">
					    		        <a id="7" class="mui-navigate-right">其他</a>
					    		    </li>
					    		</ul>
		    		        </div>
		    		        <div id="item2" class="mui-slider-item mui-control-content">
					    		<ul class="mui-table-view mui-table-view-radio">
					    		   <li class="mui-table-view-cell">
					    		        <a id="4" class="mui-navigate-right">微信支付</a>
					    		    </li>
					    		    <li class="mui-table-view-cell">
					    		        <a id="5" class="mui-navigate-right">支付宝支付</a>
					    		    </li>
					    		</ul>
		    		        </div>
		    		    </div>
		    		</div>
		    	</div>
		    	
		    	<div class="dsex">
		    		<div class="" id="sexdiv">
		    			性别：
		    		</div>
		    		<div class="mui-input-row mui-radio mui-left">
						<label>男</label>
						<input name="radio1" id="nanid" value="1" type="radio">
					</div>
					<div class="mui-input-row mui-radio mui-left">
						<label>女</label>
						<input name="radio1" id="nvid" value="2" type="radio">
					</div>
		    		<!--
                    	作者：592176224@qq.com
                    	时间：2019-01-30
                    	描述：
		    		<div class="">
		    			指定：
		    		</div>
                    -->
		    	</div>
		    	
		    	<div class="dbz">
		    		
		    		<div class="flex-row-start border-b">
		    			<span id="">
		    				备注：
		    			</span>
		    			<span id="">
		    				<input class="" id="remark" type="text" placeholder="请输入备注"/>
		    			</span>
		    		</div>
		    	</div>
		    </div>
		    
		    <div class="footgd"></div>
		    <div class="footdiv">
		    	<div class="" onclick="jiezhang(2)">
		    		挂单
		    	</div>
		    	<div class="hbg colorw" id="subut" onclick="invoicing()">
		    		立即结账
		    	</div>
		    	
		    </div>
		</div>
		
		
		
		<div id="popover" class="mui-popover">
			   <div class="listdiv">
			   		<div class="imgdiv">
			   			<img id="collectionimg" src="../../personal/employees/img/z001.png"/>
			   		</div>
			   		<div class="zfdiv" >
			   			请支付：￥<span id="zfspan">0</span> 
			   		</div>
			   		<!--<div class="footgd"></div>-->
					<div class="footbut">
						<button type="button" id="okbut" class="mui-btn mui-btn-blue mui-btn-block">确认收款</button>
					</div>
			   </div>
		</div>
		<div id="forward" class="mui-popover mui-popover-action mui-popover-bottom">
			<ul class="mui-table-view" id="yhqlist">
				
			</ul>
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a href="#forward"><b>取消</b></a>
				</li>
			</ul>
		</div>
		<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/req.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/mui.promptpwd.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var list = [],		//商品数据
			order_money = 0,	//下单金额
			recommend_id = 0,	//支付 会员id
			pay_money = 0,	//实际支付金额
			pay_id = 2,		//支付类型
			sex = 0,	//性别
			mid = 0,	//会员id
			is_stay_money = 0, //是否储蓄支付
			coupon_id	= 0, //优惠券 id
			use_balance = 0,	//使用余额金额
			stay_money = 0,		//可用余额
			man = 0,			//优惠券满足条件
			jian = 0, 	//优惠券 优惠金额
			psword = '',	//支付密码
			round_up = 2,	//是否四舍五入
			amount_payable = 0;	//应付金额
			window.onload = function(){
				mui.init();
				get_set_detail();
				
				try{
					var str = getrequest().list||"";
					console.log(str)
					mid = JSON.parse(str).mid||0;
					if(str){
						list = JSON.parse(str).goods;
					}
					if(mid > 0){
	           	 		memberdetail(mid);
	           	 	}
				}catch(e){
					//TODO handle the exception
				}
				
				mui.plusReady(function(res){
					var view = plus.webview.currentWebview();
					list = view.goods;
					console.log(JSON.stringify(list))
					mid = view.mid||0;
					if(mid > 0){
	           	 		memberdetail(mid);
	           	 	}
				})
				
				//优惠券弹框
				g("ypop").addEventListener("tap",function(e){
					mui('#forward').popover('toggle',document.getElementById("forward"));
				})
				
				/*
				 * 没有收款码，点击去上传
				 */
				g("collectionimg").addEventListener("tap",function(e){
					mui.openWindow({
	                	url:'../../personal/employees/guidepage.html',
	                	id:'guidepage',
	                })
				})
				
				
				g("okbut").addEventListener("tap",function(){
					jiezhang(1);
				})
				
				//选择优惠券
				mui('body').on('tap', '.mui-popover-action li>a', function() {
					var a = this,
						parent;
					//根据点击按钮，反推当前是哪个actionsheet
					for (parent = a.parentNode; parent != document.body; parent = parent.parentNode) {
						if (parent.classList.contains('mui-popover-action')) {
							if(!$(this).data("id")){
								return;
							}
							console.log(this);
							coupon_id = $(this).data("id");
							man = parseInt($(this).data("man"));
							jian = $(this).data("jian");
							pay_money = pay_money - jian;
							g("yhq").innerHTML = "满"+ man + "元减" + jian +"元";
							setsfvalue();
							break;
						}
					}
					//关闭actionsheet
					mui('#' + parent.id).popover('toggle');
					console.log(a.innerHTML);
				})
				//设置支付类型
           	 	mui(".mui-slider").on("tap",".mui-control-item",function(e){
					var slib = $(this).attr("href");
					var child = $(slib).siblings().children().children().removeClass("mui-selected");
					pay_id = 0;
				})
           	 	
           	 	//设置支付id
           	 	mui(".mui-table-view-radio").on("tap",".mui-table-view-cell",function(){
					pay_id = this.children[0].id;
				})
           	 	
           	 	//设置应付金额 动态绑定
           	 	$('#yfvalue').bind('chane input propertychange', function() {
           	 		order_money = this.value||0;
				  	setsfvalue();
				});
				//设置优惠金额 动态绑定
           	 	$('#yhinput').bind('chane input propertychange', function() {
				  	setsfvalue();
				});
				
				/*var mview = document.querySelector('.mui-table-view .mui-table-view-cell.mui-checkbox');
				console.log(mview)
				mview.addEventListener('tap',function(e){
					console.log(e)
					console.log(this.checked)
				    //console.log("当前选中的为："+e.detail.el.innerText);
				});*/
				
				//点击设置是余额支付
				g("checkcxzf").addEventListener("change",function(e){
						//setsfvalue();
						console.log();
					if(this.checked){
						console.log("余额支付");
						mui.promptPwd("请输入支付密码","","余额支付",["取消","确认"],function(e){
							if(e.index == 1){
								pay_id = 8;
								console.log(e.value);
								psword = e.value;
							}else{
								$("#checkcxzf").prop("checked",false);
								$("#dpaydiv").removeClass("hidden");
							}
						},'div')
						
						$("#dpaydiv").addClass("hidden");
					}else{
						
						$("#dpaydiv").removeClass("hidden");
					}
						
				})
				//getpaysort();
				//getpayimg();
			}
			
			/*
			 * 获取收款二维码
			 */
			function getpayimg(){
				var data = {
					url:"/api/store/get_receipt",
					data:{
						access_token:acctoken(),
					}
				}
				ajax(data,function(res){
					console.log("收款码二维码",res);
					if(pay_id == 5 &&res.data.alipay_url.length > 40){
						g("collectionimg").src = res.data.alipay_url;
					}
					if(pay_id == 4 && res.data.wxpay_url.length > 40){
						g("collectionimg").src = res.data.wxpay_url;
					}
					
				})
			}
			
			
			//监听获得会员id执行函数
			window.addEventListener("setmamber", setmamber); //添加自定义事件，其他页面调用
			function setmamber(e) {
				mid = e.detail.mid;
				memberdetail(mid);
            }
			
			
			
			//获取配置文件
			function get_set_detail(){
				var that = this;
				var data = {
					url:"/api/set/detail",
					data:{
						access_token:acctoken(),
					}
				}
				ajax(data,function(res){
					console.log("参数对象",res);
					round_up = res.data.round_up;
					setgoods(list);
				},"post",function(err){
					setgoods(list);
				})
			}
			/*
			 * 挂单
			 */
			function invoicing(){
				if(pay_id == 0){
					mui.toast("请选择支付方式！");
					return;
				}
				if(pay_id == 4 || pay_id == 5){
					getpayimg();
					mui('#popover').popover('toggle',g("popover"));
				}else{
					jiezhang(1);
				}
			}
			
			function jiezhang(type) {
				
				
				var is_use_balance = g("checkcxzf").checked;
				//console.log(is_use_balance)
				//return;
				var list2 = [];
				if(pay_id == 0){
					mui.toast("请选择支付方式！");
					return;
				}
				for(var i = 0; i < list.length; i++){
					var str = {
						"product_id":list[i].product_id, // 下单的商品id
			    		"product_number":list[i].product_number, // 下单的商品数量
			    		"product_price":list[i].product_price, // 下单的商品单价(可修改)
			    		//"product_type":list[i].product_type, // 下单的商品类型(1是商品 2是服务)
			    		"is_appoint":list[i].is_appoint, // 是否指定(1是指定 2是不指定)
			    		"employee":[]
					}
					for(var j = 0; j < list[i].employee.length;j++){
						var str2 = {
							"employee_id":list[i].employee[j].employee_id, // 获取提成的员工id
		    				"is_appoint":list[i].employee[j].is_appoint,// 是否指定
		    				"percent_point":list[i].employee[j].percent_point, // 提成点
		    				"percent_money":list[i].employee[j].percent_money // 提成金额
						}
						if(list[i].employee[j].is_appoint == 1){
							str.is_appoint = 1;
						}
						str.employee.push(str2);
					}
					list2.push(str);
				}
				var sexid = parseInt($("input[type='radio']:checked").val());
				var reduce_money = g("yhinput").value;
           	 		var data = {
           	 			url:"/api/order/place",
           	 			data:{
           	 				access_token:acctoken(),
           	 				member_id:recommend_id,
           	 				order_money:order_money,
           	 				reduce_money:reduce_money>0?reduce_money:0,
           	 				pay_money:pay_money,
           	 				pay_id:pay_id,
           	 				coupon_id:coupon_id,
           	 				use_balance:use_balance,
           	 				is_use_balance:is_use_balance?1:2,
           	 				order_status:type,
           	 				sex:sexid,
           	 				remark:g("remark").value,
           	 				product:list2,
           	 				password:psword,
           	 			}
           	 		}
           	 		console.log(JSON.stringify(data));
           	 		//return;
           	 		ajax(data,function(res){
           	 			console.log("下单",res)
           	 			console.log(JSON.stringify(res))
           	 			mui.toast(res.msg);
           	 			if(type == 1){
           	 				var data = {
								order_number:res.data.order_number||"",
								createtime:res.data.createtime||"",
								pay_sort:res.data.pay_sort.name||"",
								pay_money:pay_money||"0"
							}
       	 					mui.openWindow({
			                	url:'../../general/successpay.html',
			                	id:'successpay',
			                	extras: data,
			                })
           	 			}else{
           	 				setTimeout(function(e){
           	 					var cPage = plus.webview.currentWebview();
							    var bPage = cPage.opener();
							    var aPage = bPage.opener();
							    cPage.close();
							    bPage.close();
							    aPage.close();
           	 				},300)
           	 			}
           	 		},'post',function(err){
           	 			console.log("失败",err);
           	 			if(err.error_code == 400){
           	 				$("#dpaydiv").removeClass("hidden");
           	 				g("checkcxzf").checked = false;
           	 				//获取支付类型
           	 				pay_id = parseInt($(".mui-selected").find('a')[0].id);
           	 			}
           	 		})
           	 	}
			
			function getVals(){
			    var res = getCheckBoxRes('rds');
			    if(res.length < 1){
			        mui.toast('请选择');
			        return;
			    }
			    mui.toast(res);
			}
			
			function getCheckBoxRes(className){
			    var rdsObj   = document.getElementsByClassName(className);
			    var checkVal = new Array();
			    var k        = 0;
			    for(i = 0; i < rdsObj.length; i++){
			        if(rdsObj[i].checked){
			            checkVal[k] = rdsObj[i].value;
			            k++;
			        }
			    }
			    return checkVal;
			}
			
			//设置金额
			function setgoods(data){
				console.log("商品数据",data);
				var yfvalue = 0;
				if(data&&data.length > 0){
					data.forEach(function(item,index){
						yfvalue += parseInt(item.product_number)*parseFloat(item.product_price);
					})
				}
				if(round_up == 1){
					yfvalue = round(yfvalue);
				}else{
					yfvalue = yfvalue.toFixed(2);
				}
				console.log("应付",yfvalue);
				order_money = yfvalue;
				g("yfvalue").value = yfvalue;
				
				setsfvalue();
			}
			
			
			//设置还需金额
			function setsfvalue(){
				
				pay_money = parseFloat(g("yfvalue").value||0);
				var yh = g("yhinput").value||0;
				//先计算优惠
				if(yh > 0){
					if(pay_money - yh > 0){
						pay_money = pay_money - yh;
					}else{
						pay_money = 0;
					}
				}
				
				//在计算 优惠券
				if(jian > 0 && pay_money > man){
					if(pay_money - jian > 0){
						pay_money = pay_money - jian;
					}else{
						pay_money = 0;
					}
				}else{
					g("yhq").innerHTML = "优惠券未达条件";
					man = 0;
					jian = 0;
				}
				
				
				
				//最后计算是否储蓄余额支付
				/*
				if(stay_money > 0 && g("checkcxzf").checked){
					console.log(pay_money)
					console.log(stay_money)
					if(pay_money > stay_money){
						use_balance = pay_money - stay_money;
						pay_money = use_balance
					}else{
						use_balance = pay_money;
						pay_money = 0;
					}
				}
				*/
				g("sfvalue").innerHTML = "￥"+pay_money.toFixed(2);
				g("zfspan").innerHTML = pay_money.toFixed(2);
			}
			
			//id查询搜索会员
			function memberdetail(mid){
				var data = {
					url:"/api/member/detail",
					data:{
						access_token:acctoken(),
						id:mid,
					}
				}
				ajax(data,function(res){
					//console.log(JSON.stringify(res));
					console.log("单个会员详情",res);
					//stay_money
					recommend_id = res.data.id;
					stay_money = res.data.stay_money;
					setgoods(list);
					setmember(res.data);
				})
			}
			
			function setmember(list){
				//设置性别
				setxb(list.sex);
				//设置储值支付
				setcxzf(list.stay_money);
				//设置优惠券
				setyhq(list.member_coupon);
				var str = '<div class="flex1"><div class="dleft">';
						if(list.images&&list.images.path_name){
							str += '<img class="border50" src="'+list.images.path_name+'"/>';
						}else{
							str += '<img class="border50" src="../../img/member-header.png"/>';
						}
		    	    	str += '</div>'+
		    	    	'<div class="right"><div class="flexrowbetween"><span id="">'+
		    	    	list.username +
		    	    	'</span><span class="fe07">'+
		    	    	'</span></div><div id="" class="fe07">'+
		    	    	'</div><div id="" class="fe07">'+
		    	    	'余额：'+list.stay_money+'元'+
		    	    	'</div></div></div>';
    					
		    	g("memberdiv").innerHTML = str;  
			}
			//储蓄支付
			function setcxzf(value){
				$("#czzfli").removeClass("hidden");
				
				//var str = value;
				
				//g("cxzf").innerHTML = "可用余额<span class='red'>"+str+"</span>元";
				
			}
			//优惠券
			function setyhq(list){
				$("#ypop").removeClass("hidden");
				console.log("优惠券",list);
				var str = '';
				if(list&&list.length > 0){
					list.forEach(function(item,index){
						if(order_money >= parseFloat(item.coupon_condition)){
							
							str += '<li class="mui-table-view-cell">'+
								'<a href="#" data-id="'+item.id+'" data-man="'+item.coupon_condition+'"' +
								' data-jian="'+item.coupon_money+'">'+
								'满'+item.coupon_condition+' 减'+
								item.coupon_money +
								'</a></li>';
						}else{
							str += '<li class="mui-table-view-cell">'+
								'<a href="#">'+
								'满'+item.coupon_condition+' 减'+
								item.coupon_money +'(未达条件)'+
								'</a></li>';
						}
					})
				}
				
				g("yhqlist").innerHTML = str;
				if(list&&list.length){
					g("yhq").innerHTML = list.length +"张";
				}
			}
			//性别
			function setxb(sex){
				var sdiv = g("sexdiv");
				if(sex == 1){
					g("nanid").checked = true;
				}else if(sex == 2){
					g("nvid").checked = true;
				}
			}
			
			function setmemberid(id,name){
				recommend_id = id;
				g("recommend").innerHTML = name;
			}
		</script>
	</body>

</html>